Drive: Drive control
This module is the vehicle drive module. This module is provided in EdgerOS 2.0.0 and later, and apps need to have vehicle.drive permission to use this module.
User can use the following code to import the Drive module.
var Drive = require('vehicle/drive');
Support
The following shows Drive module APIs available for each permissions.
| User Mode | Privilege Mode | |
|---|---|---|
| Drive | ● | ● |
| drive.request | ● | ● |
| drive.release | ● | ● |
| drive.pedal | ● | ● |
| drive.steering | ● | ● |
| drive.gear | ● | ● |
| drive.epb | ● | ● |
Drive Class
new Drive()
- Returns: {Object} Drive object.
Create a Drive object.
Drive Object
drive.request(callback)
callback{Function} Callback.error{Error} Specify the error message when the request is failed.
Request for vehicle drive operation. After the request is successful, App can drive the vehicle.
drive.release()
Release the current Drive object, no operation is allowed after the object is released.
The object needs to be released as soon as possible when it is no longer used.
drive.pedal(param, callback)
param{Object} Pedal parameter.callback{Function} Callback.error{Error} Specify the error message when failed.
Set vehicle pedal state, param can have the following members:
accel{Integer} Acceleration pedal0-5brake{Integer} Brake pedal0-100reliable{Boolean} Whether it is a reliable setting, if there are continuous control instructions behind, the intermediate instruction part reliable can befalse.
drive.steering(param, callback)
param{Object} Steering parameter.callback{Function} Callback.error{Error} Specify the error message when failed.
Set vehicle steering position, param can have the following members:
pos{Integer} Steering position-780R -780Lreliable{Boolean} Whether it is a reliable setting, if there are continuous control instructions behind, the intermediate instruction part reliable can befalse.
drive.gear(param, callback)
param{Object} Steering parameter.callback{Function} Callback.error{Error} Specify the error message when failed.
Set vehicle gear setting, param can have the following members:
gear{String}'P'|'R'|'N'|'D'|'S'
drive.epb(param, callback)
param{Object} Steering parameter.callback{Function} Callback.error{Error} Specify the error message when failed.
Set vehicle EPB setting, param can have the following members:
status{Integer}0: Parking1: Release.




陕公网安备61019002002605号